from apps.utils.enum import PendingStatus
from sqlalchemy import Column, String, Integer, ForeignKey, SmallInteger, Enum
from apps.models.base import Base


class Drift(Base):
    """
        一次具体的交易信息
    """
    __tablename__ = 'drift'
    id = Column(Integer, primary_key=True)
    recipient_name = Column(String(20), nullable=False)
    address = Column(String(100), nullable=False)
    message = Column(String(200))
    mobile = Column(String(20), nullable=False)
    isbn = Column(String(13))
    book_title = Column(String(50))
    book_author = Column(String(30))
    book_img = Column(String(50))
    # requester_id = Column(Integer, ForeignKey('user.id'))
    # requester = relationship('User')
    requester_id = Column(Integer)
    requester_nickname = Column(String(20))
    gifter_id = Column(Integer)
    gift_id = Column(Integer)
    gifter_nickname = Column(String(20))
    pending = Column(Enum(PendingStatus), default=PendingStatus.waiting)
    # gift_id = Column(Integer, ForeignKey('gift.id'))
    # gift = relationship('Gift')

